/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.util.nastranHdf5Parser.constant;

import java.util.List;
import java.util.Map;

public enum NastranDatasetConfig {

    DISPLACEMENTS(
            "displacements",
            "/NASTRAN/RESULT/NODAL/DISPLACEMENT",
            List.of("ID", "X", "Y", "Z", "RX", "RY", "RZ", "DOMAIN_ID"),
            List.of("t1", "t2", "t3", "r1", "r2", "r3"),
            Map.of(
                    "element", "ID",
                    "values", List.of("X","Y","Z","RX","RY","RZ")
            )
    ),
    CROD_FORCE(
            "force.crod_force",
            "/NASTRAN/RESULT/ELEMENTAL/ELEMENT_FORCE/ROD",
            List.of("EID", "AF", "TRQ", "DOMAIN_ID"),
            List.of("axial", "torsion"),
            Map.of(
                    "element", "EID",
                    "values", List.of("AF","TRQ")
            )
    ),
    CBUSH_FORCE(
            "force.cbush_force",
            "/NASTRAN/RESULT/ELEMENTAL/ELEMENT_FORCE/BUSH",
            List.of("EID","FX","FY","FZ","MX","MY","MZ","DOMAIN_ID"),
            List.of("fx","fy","fz","mx","my","mz"),
            Map.of(
                    "element","EID",
                    "values", List.of("FX","FY","FZ","MX","MY","MZ")
            )
    ),
    CBAR_FORCE(
            "force.cbar_force",
            "/NASTRAN/RESULT/ELEMENTAL/ELEMENT_FORCE/BAR",
            List.of("EID","BM1A","BM2A","BM1B","BM2B","TS1","TS2","AF","TRQ","DOMAIN_ID"),
            List.of("bending_moment_a1","bending_moment_a2","bending_moment_b1","bending_moment_b2",
                    "shear1","shear2","axial","torque"),
            Map.of(
                    "element","EID",
                    "values", List.of("FX","FY","FZ","MX","MY","MZ")
            )
    ),
    CTRIA3_FORCE(
            "force.ctria3_force",
            "/NASTRAN/RESULT/ELEMENTAL/ELEMENT_FORCE/TRIA3",
            List.of("EID","MX","MY","MXY","BMX","BMY","BMXY","TX","TY","DOMAIN_ID"),
            List.of("mx","my","mxy","bmx","bmy","bmxy","tx","ty"),
            Map.of(
                    "element","EID",
                    "values", List.of("MX","MY","MXY","BMX","BMY","BMXY","TX","TY")
            )
    ),
    CQUAD4_FORCE(
            "force.cquad4_force",
            "/NASTRAN/RESULT/ELEMENTAL/ELEMENT_FORCE/QUAD4",
            List.of("EID","MX","MY","MXY","BMX","BMY","BMXY","TX","TY","DOMAIN_ID"),
            List.of("mx","my","mxy","bmx","bmy","bmxy","tx","ty"),
            Map.of(
                    "element","EID",
                    "values", List.of("MX","MY","MXY","BMX","BMY","BMXY","TX","TY")
            )
    ),
    SPC_FORCE(
            "spc_forces",
            "/NASTRAN/RESULT/NODAL/SPC_FORCE",
            List.of("ID","X","Y","Z","RX","RY","RZ","DOMAIN_ID"),
            List.of("t1","t2","t3","r1","r2","r3"),
            Map.of(
                    "element","ID",
                    "values", List.of("X","Y","Z","RX","RY","RZ")
            )
    ),
    MPC_FORCE(
            "mpc_forces",
            "/NASTRAN/RESULT/NODAL/MPC_FORCE",
            List.of("ID","X","Y","Z","RX","RY","RZ","DOMAIN_ID"),
            List.of("t1","t2","t3","r1","r2","r3"),
            Map.of(
                    "element","ID",
                    "values", List.of("X","Y","Z","RX","RY","RZ")
            )
    ),
    GRID_FORCE(
            "grid_point_forces",
            "/NASTRAN/RESULT/NODAL/GRID_FORCE",
            List.of("ID","EID","ELNAME[8]","F1","F2","F3","M1","M2","M3","DOMAIN_ID"),
            List.of("t1","t2","t3","r1","r2","r3"),
            Map.of(
                    "element","ID",
                    "values", List.of("X","Y","Z","RX","RY","RZ")
            )
    ),
    CELAS1_FORCE(
            "force.celas1_force",
            "/NASTRAN/RESULT/ELEMENTAL/ELEMENT_FORCE/ROD",
            List.of("EID","F","DOMAIN_ID"),
            List.of("spring_force"),
            Map.of(
                    "element","EID",
                    "values", List.of("F")
            )
    );

    private final String resultName;
    private final String path;
    private final List<String> fields;
    private final List<String> headers;
    private final Map<String, Object> fieldMapping;

    NastranDatasetConfig(String resultName, String path, List<String> fields,
                         List<String> headers, Map<String, Object> fieldMapping) {
        this.resultName = resultName;
        this.path = path;
        this.fields = fields;
        this.headers = headers;
        this.fieldMapping = fieldMapping;
    }

    public String getResultName() {
        return resultName;
    }

    public String getPath() {
        return path;
    }

    public List<String> getFields() {
        return fields;
    }

    public List<String> getHeaders() {
        return headers;
    }

    public Map<String, Object> getFieldMapping() {
        return fieldMapping;
    }
}
